yjx.controller('msgTeamController', ['$rootScope', '$scope', '$timeout', '$fetch', 'modalService','ipCookie', function ($rootScope, $scope, $timeout, $fetch, modalService,ipCookie) {
    var params = {
        limit: 20,
        offset: 1,
        type: 2
    }
    $scope.pageNum = 1;
    $scope.hideShows = true;
    $rootScope.identity = $rootScope.identity?$rootScope.identity:ipCookie('identity')
    if ($rootScope.identity == 1) {
        getMsgList();
    }
    function getMsgList() {
        $fetch.fetch(
            '/message/me',
            {
                params: params,
                cache: false
            }

        ).then(function (data) {
            $timeout(function () {
                if (data) {
                    $scope.paging = data.page;
                    $scope.dataList = data.list;
                    //更新状态、数据加载控制
                    $scope._updated = 'reupdated';
                    $scope.hideShows = false;
                }
            })
        }).catch(function (e) {
            modalService.mainMsgError(e.msg);
        })
    }

    /*翻页*/
    $scope.list = function () {
        params.offset = $scope.pageNum;
        $fetch.fetch(
            '/message/me',
            {
                params: params,
                cache: false
            }
        ).then(function (data) {
            $timeout(function () {
                if (data) {
                    $scope.paging = data.page;
                    $scope.dataList = $scope.dataList.concat(data.list);
                    //更新状态、数据加载控制
                    $scope._updated = 'updated';
                    $scope.hideShows = false;
                }
            })
        }).catch(function (e) {
            modalService.mainMsgError(e.msg);
        })
    }
    $scope.temple = '<li class="messageLi" ng-repeat="item in dataList"><p class="content">{{item.content}}</p></li>'
}])